// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= //
//  »Project«   Talina Gaming System (TgS) (∂)
//  »File«      TgS Common - Geometry 3D - Triangle [Space].h_inc
//  »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
//  »Version«   4.0
// ------------------------------------------------------------------------------------------------------------------------------ //
//  Copyright: © 2002-2010, Andrew Aye.  All Rights Reserved.
//  This software is free for non-commercial use. Redistribution and use in source and binary forms, with or without modification,
//  are permitted provided that the following conditions are met: 
//    Redistributions of source code must retain this copyright notice, this list of conditions and the following disclaimers. 
//    Redistributions in binary form must reproduce this copyright notice, this list of conditions and the following
//      disclaimers in the documentation and other materials provided with the distribution. 
//  Neither the names of the copyright owner nor the names of its contributors may be used to endorse or promote products derived
//  from this software without specific prior written permission. 
//  The intellectual property rights of the algorithms used reside with Andrew Aye.  You may not use this software, in whole or
//  in part, in support of any commercial product without the express written consent of the author.
//  There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= //

TgINLINE TgBOOL                                 V(tgGM_Is_Point_Culled_ST)( V(CPCU_TgSTRI), const TYPE, const TYPE );
TgINLINE TgVOID                                 V(tgGM_Reset_Flags_ST)( V(PCU_TgSTRI) );
TgINLINE TgVOID                                 V(tgGM_Calc_Space_ST)( V(PCU_TgSTRI) );
TgINLINE TgVOID                                 V(tgGM_Calc_Normal_ST)( V(PCU_TgSTRI) );
TgINLINE V(TgVEC)                               V(tgGM_Calc_Point_ST)( V(CPCU_TgSTRI), const TYPE, const TYPE );

TgINLINE TgVOID                                 V(tgGM_Constructor_ST)( V(PCU_TgSTRI) );
TgINLINE TgVOID                                 V(tgGM_Reset_ST)( V(PCU_TgSTRI) );
TgINLINE TgBOOL                                 V(tgGM_Is_Valid_ST)( V(CPCU_TgSTRI) );
TgINLINE V(TgVEC)                               V(tgGM_Support_Point_ST)( V(CPCU_TgSTRI), V(CPCU_TgVEC) );
TgINLINE TYPE                                   V(tgGM_Area_ST)( V(CPCU_TgSTRI) );
TgINLINE TgVOID                                 V(tgGM_BA_ST)( V(PCU_TgBOXAA), V(CPCU_TgSTRI) );
TgINLINE TgVOID                                 V(tgGM_Sweep_BA_ST)( V(PCU_TgBOXAA), V(CPCU_TgSTRI), V(CPCU_TgVEC) );
TgINLINE TgVOID                                 V(tgGM_Project_ST)( PCU_TYPE, PCU_TYPE, V(CPCU_TgSTRI), V(CPCU_TgVEC) );
TgINLINE TgBOOL                                 V(tgGM_Is_Contained_ST)( V(CPCU_TgSTRI), V(CPCU_TgVEC) );
TgINLINE TgVOID                                 V(tgGM_TX_ST)( V(PCU_TgSTRI), M34(CPCU_TgMAT) );
TgINLINE TgVOID                                 V(tgGM_Copy_TX_ST)( V(PCU_TgSTRI), V(CPCU_TgSTRI), M34(CPCU_TgMAT) );

TgINLINE TgVOID                                 V(tgGM_Init_PN_ST)(
                                                    V(PCU_TgSTRI), V(CPCU_TgVEC), V(CPCU_TgVEC), V(CPCU_TgVEC), V(CPCU_TgVEC) );
TgINLINE TgVOID                                 V(tgGM_Init_P_ST)( V(PCU_TgSTRI), V(CPCU_TgVEC), V(CPCU_TgVEC), V(CPCU_TgVEC) );
TgINLINE TgVOID                                 V(tgGM_Init_EN_ST)(
                                                    V(PCU_TgSTRI), V(CPCU_TgVEC), V(CPCU_TgVEC), V(CPCU_TgVEC), V(CPCU_TgVEC) );
TgINLINE TgVOID                                 V(tgGM_Init_E_ST)( V(PCU_TgSTRI), V(CPCU_TgVEC), V(CPCU_TgVEC), V(CPCU_TgVEC) );
TgINLINE TgVOID                                 V(tgGM_Init_PT_ST)( V(PCU_TgSTRI), V(CPCU_TgPTRI) );
TgINLINE TgVOID                                 V(tgGM_Init_ET_ST)( V(PCU_TgSTRI), V(CPCU_TgETRI) );
TgINLINE TgVOID                                 V(tgGM_Init_CT_ST)( V(PCU_TgSTRI), V(CPCU_TgCTRI) );
TgINLINE TgVOID                                 V(tgGM_Copy_ST)( V(PCU_TgSTRI), V(CPCU_TgSTRI) );
TgINLINE TgVOID                                 V(tgGM_Set_Origin_ST)( V(PCU_TgSTRI), V(CPCU_TgVEC) );
TgINLINE TgVOID                                 V(tgGM_Set_Point_0_ST)( V(PCU_TgSTRI), V(CPCU_TgVEC) );
TgINLINE TgVOID                                 V(tgGM_Set_Point_1_ST)( V(PCU_TgSTRI), V(CPCU_TgVEC) );
TgINLINE TgVOID                                 V(tgGM_Set_Point_2_ST)( V(PCU_TgSTRI), V(CPCU_TgVEC) );
TgINLINE TgVOID                                 V(tgGM_Set_Edge_0_ST)( V(PCU_TgSTRI), V(CPCU_TgVEC) ); //« Point 0 to Point 1;
TgINLINE TgVOID                                 V(tgGM_Set_Edge_1_ST)( V(PCU_TgSTRI), V(CPCU_TgVEC) ); //« Point 1 to Point 2;
TgINLINE TgVOID                                 V(tgGM_Set_Edge_2_ST)( V(PCU_TgSTRI), V(CPCU_TgVEC) ); //« Point 2 to Point 0;
TgINLINE TgVOID                                 V(tgGM_Set_Flags_ST)( V(PCU_TgSTRI), C_TgUINT32 );

TgINLINE V(TgVEC)                               V(tgGM_Query_Origin_ST)( V(CPCU_TgSTRI) );
TgINLINE V(TgVEC)                               V(tgGM_Query_Normal_ST)( V(CPCU_TgSTRI) );
TgINLINE V(TgVEC)                               V(tgGM_Query_Point_0_ST)( V(CPCU_TgSTRI) );
TgINLINE V(TgVEC)                               V(tgGM_Query_Point_1_ST)( V(CPCU_TgSTRI) );
TgINLINE V(TgVEC)                               V(tgGM_Query_Point_2_ST)( V(CPCU_TgSTRI) );
TgINLINE V(TgVEC)                               V(tgGM_Query_Point_ST)( V(CPCU_TgSTRI), C_TgSINT32 );
TgINLINE V(TgVEC)                               V(tgGM_Query_Edge_0_ST)( V(CPCU_TgSTRI) );
TgINLINE V(TgVEC)                               V(tgGM_Query_Edge_1_ST)( V(CPCU_TgSTRI) );
TgINLINE V(TgVEC)                               V(tgGM_Query_Edge_2_ST)( V(CPCU_TgSTRI) );
TgINLINE V(TgVEC)                               V(tgGM_Query_Edge_ST)( V(CPCU_TgSTRI), C_TgSINT32 );
TgINLINE V(CP_TgPLANE)                          V(tgGM_Query_Edge_Plane_0_ST)( V(CPCU_TgSTRI) );
TgINLINE V(CP_TgPLANE)                          V(tgGM_Query_Edge_Plane_1_ST)( V(CPCU_TgSTRI) );
TgINLINE V(CP_TgPLANE)                          V(tgGM_Query_Edge_Plane_2_ST)( V(CPCU_TgSTRI) );
TgINLINE V(CP_TgPLANE)                          V(tgGM_Query_Edge_Plane_ST)( V(CPCU_TgSTRI), C_TgSINT32 );
TgINLINE V(CP_TgPTRI)                           V(tgGM_Query_PT_ST)( V(CPCU_TgSTRI) );
TgINLINE V(CP_TgETRI)                           V(tgGM_Query_ET_ST)( V(CPCU_TgSTRI) );
TgINLINE V(CP_TgCTRI)                           V(tgGM_Query_CT_ST)( V(CPCU_TgSTRI) );
TgINLINE TgUINT32                               V(tgGM_Query_Flags_ST)( V(CPCU_TgSTRI) );

TgINLINE TgVOID                                 V(tgGM_Set_Test_Point_ST)( V(PCU_TgSTRI), C_TgSINT32, C_TgBOOL );
TgINLINE TgVOID                                 V(tgGM_Set_Test_Point_0_ST)( V(PCU_TgSTRI), C_TgBOOL );
TgINLINE TgVOID                                 V(tgGM_Set_Test_Point_1_ST)( V(PCU_TgSTRI), C_TgBOOL );
TgINLINE TgVOID                                 V(tgGM_Set_Test_Point_2_ST)( V(PCU_TgSTRI), C_TgBOOL );
TgINLINE TgVOID                                 V(tgGM_Set_Test_Edge_ST)( V(PCU_TgSTRI), C_TgSINT32, C_TgBOOL );
TgINLINE TgVOID                                 V(tgGM_Set_Test_Edge_0_ST)( V(PCU_TgSTRI), C_TgBOOL ); //« Point 0 to Point 1;
TgINLINE TgVOID                                 V(tgGM_Set_Test_Edge_1_ST)( V(PCU_TgSTRI), C_TgBOOL ); //« Point 0 to Point 2;
TgINLINE TgVOID                                 V(tgGM_Set_Test_Edge_2_ST)( V(PCU_TgSTRI), C_TgBOOL ); //« Point 1 to Point 2;

TgINLINE TgBOOL                                 V(tgGM_Test_Point_ST)( V(CPCU_TgSTRI), C_TgSINT32 );
TgINLINE TgBOOL                                 V(tgGM_Test_Point_0_ST)( V(CPCU_TgSTRI) );
TgINLINE TgBOOL                                 V(tgGM_Test_Point_1_ST)( V(CPCU_TgSTRI) );
TgINLINE TgBOOL                                 V(tgGM_Test_Point_2_ST)( V(CPCU_TgSTRI) );
TgINLINE TgBOOL                                 V(tgGM_Test_Edge_ST)( V(CPCU_TgSTRI), C_TgSINT32 );
TgINLINE TgBOOL                                 V(tgGM_Test_Edge_0_ST)( V(CPCU_TgSTRI) );
TgINLINE TgBOOL                                 V(tgGM_Test_Edge_1_ST)( V(CPCU_TgSTRI) );
TgINLINE TgBOOL                                 V(tgGM_Test_Edge_2_ST)( V(CPCU_TgSTRI) );


//TgINLINE TgVOID                                 G(ST,M_TX)( V(PCU_TgSTRI), M34(CPCU_TgMAT) );
//TgINLINE TgVOID                                 G(ST,M_Copy_TX)( V(PCU_TgSTRI), V(CPCU_TgSTRI), M34(CPCU_TgMAT) );